package com.spring.config;

import org.springframework.boot.web.servlet.error.DefaultErrorAttributes;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.WebRequest;

import java.util.Map;

@Component
public class MyErrorAttribute extends DefaultErrorAttributes {
    public Map<String,Object> getErrorAttributes(WebRequest request, boolean includeStackTrace){
        Map<String,Object> map=super.getErrorAttributes(request,includeStackTrace);
        map.put("custommsg","出错了");
        //map.remove("error");
        return map;
    }
}
